package com.batchaps.gameentity;

import java.io.IOException;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author GPQuy
 */
public class Sound {
    private  Player playerFighted;
    private  Player playerSmile;
    public Sound(){
        try {
            playerFighted = Manager.createPlayer(getClass().getResourceAsStream("/audio/bidanh.wav"),"audio/X-wav");
            playerSmile=Manager.createPlayer(getClass().getResourceAsStream("/audio/catsmile.wav"),"audio/X-wav");
            playerFighted.realize();
            playerSmile.realize();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (MediaException ex) {
            ex.printStackTrace();
        }
    }
    public void playerFightedSound(){
        try {
            playerFighted.start();
        } catch (MediaException ex) {
            ex.printStackTrace();
        }
    }
    public void playerSmileSound(){
        try {
            playerSmile.start();
        } catch (MediaException ex) {
            ex.printStackTrace();
        }
    }
}

